﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T.FAS.Runtime.DataAccess.SQLDom
{
    /// <summary>
    /// 排序条件
    /// </summary>
    [Serializable]
    public class OrderByClause
    {
        public List<string> OrderByFields { get; set; }

        public OrderByType OrderByType { get; set; }

        public FieldType FieldType { get; set; }

        public OrderByClause()
        {

        }
        public OrderByClause(OrderByType orderByType, FieldType fieldType, params string[] fields)
        {
            FieldType = fieldType;
            OrderByType = orderByType;
            OrderByFields = fields == null ? new List<string>() : fields.ToList();
        }

        public OrderByClause Clone()
        {
            OrderByClause orderByClause = new OrderByClause
            {
                OrderByType = this.OrderByType,
                FieldType = this.FieldType,
                OrderByFields = OrderByFields.Select(o => o).ToList(),
            };
            return orderByClause;
        }
    }    
}
